<template>
  <div>
    <p @click="exportImage">导出图片</p>
  </div>
</template>

<script setup>
import { onMounted } from "vue";
let $map=null;
onMounted(()=>{
    // $docLayer=inject("$map")
    $map=inject("$map")
})
/* 导出图片 */
function exportImage() {
  $map.once("postcompose", function (event) {
    const canvas = event.context.canvas;
    console.log(canvas);
    canvas.toBlob(function (blob) {
      console.log(blob);
      saveAs(blob, "map.png");
    });
  });
  $map.renderSync();
}
</script>

<style lang="scss" scoped></style>
